//
//  HttpRequestPlatformInterface.h
//  EZC_Library
//
//  Created by ellzu on 14-9-23.
//  Copyright (c) 2014年 ellzu. All rights reserved.
//

#ifndef __EZC_Library__HttpRequestPlatformInterface__
#define __EZC_Library__HttpRequestPlatformInterface__

#include <stdio.h>
#include <string>
#include "EZTally/EZTallyObject.h"
#include <map>
#include "HttpRequest.h"
#include "HttpResponse.h"


namespace EZHttp {
    
    /**
     针对平台实现的http请求 接口
     **/
    class HttpRequestPlatformInterface : public EZTally::EZTallyObject
    {
    public:
        HttpRequestPlatformInterface();
        
        void setOwnRequest(HttpRequest* request);
        HttpRequest* ownRequest();
    protected:
        virtual ~HttpRequestPlatformInterface();
        
        
        
        HttpRequest *_ownRequest;
        
        //request method
        
        std::map<std::string, std::string>* requestValues();
        
        //call delegate trigger on subObj
        void onHttpRequestResponseHeader();
        void onHttpRequestSuccess();
        void onHttpRequestFail();
        size_t onHttpRequestReciveContent(unsigned char* data,size_t dataLen);

//        void onHttpRequestProgress();
        
        unsigned int _alreadyCallPercent;
        size_t _contentLen;
        size_t _curLen;
        //response method
        
        void response_setContentLen(size_t len);

        
    public:
        
        virtual void startSync() = 0;
        virtual void startAsync() = 0;
    };
}
#endif /* defined(__EZC_Library__HttpRequestPlatformInterface__) */
